var baseurl = "http://ui11.hfjava.com";
function ajax(url,param,f){
    $.ajax({
        type:"POST",
        url:baseurl+url,
        contentType:"application/json;charset=utf-8",
        data:JSON.stringify(param),
        success:function(data){
            f(data);
        }
    });
 }
var issend = false;
function sendMsg(telValue,isRealSend){
    if(issend){
        return;
    }

    issend = true;

    var i = 60;

    getyzm.innerHTML =  i+"s后重新获取";

    var timer = setInterval(function(){
        i--;
        if(i==0){
            getyzm.innerHTML = "获取验证码";
            clearInterval(timer);
            tip.innerHTML = "";
            issend = false;
            return;
        }
        getyzm.innerHTML =  i+"s后重新获取";
    },1000);

    //发短信
    if(isRealSend){
        $.ajax({
            type:"POST",
            url:baseurl+"/bijiyzm/add",
            contentType : "application/json; charset=utf-8", //会发一个用UTF-8编码的JSON的字符串给服务器
            data:JSON.stringify({ //data就是这个字符串
                tel:telValue
            }),
            success:function(data){ //data返回给前端的东西
                if(data){//如果data为true
                    tip.innerHTML = "短信已经发送！";
                }else{
                    tip.innerHTML = "短信发送失败！";
                }
            }
        })
    }
}